<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <style type="text/css">
    body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
    #allmap{height:500px;width:100%;}
    #r-result{width:100%; font-size:14px;}
</style>
    <script src="__static__/Common/jquery.min.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=dgFqXYUVU3KvGuGuBMGGdIaRVNyMYupc"></script>
    <script src="__static__/Common/jquery.min.js"></script>
    <script src="__static__/Common/vue.js"></script>
    <title>城市名定位</title>
</head>
<body>
<div id="allmap"></div>
<div id="app">
    <input v-show="userinfodata.Position<11" type="submit" value="发布签到" id="beginsign">
    <input  v-show="userinfodata.Position<11" type="submit" value="签到" id="cun">
    <input  v-show="userinfodata.Position<=11" type="submit" value="签到" id="sign">
</div>
</body>
</html>
<!--<script type="text/javascript">-->
    <!--// 百度地图API功能-->
    <!--var __DOMAIM__ = location.origin;   //协议+域名+端口-->
    <!--//协议+域名+端口+php入口-->
    <!--var __APIHOST__ = __DOMAIM__ + '/api/';-->
    <!--var __AUTH__ = {"auth": "wy_jsjxhj6eZRxMTx2yiyunZvnG8R65"};-->
    <!--var map = new BMap.Map("allmap");-->
    <!--var point = new BMap.Point(116.331398,39.897445);-->
    <!--map.centerAndZoom(point,12);-->
    <!--var geolocation = new BMap.Geolocation();-->
    <!--geolocation.getCurrentPosition(function(r){-->
        <!--if(this.getStatus() == BMAP_STATUS_SUCCESS){-->
            <!--var mk = new BMap.Marker(r.point);-->
            <!--map.addOverlay(mk);-->
            <!--map.panTo(r.point);-->
            <!--$.ajax({-->
                <!--type: "POST",-->
                <!--url: "api/saveloca",-->
                <!--dataType: "json",-->
                <!--data: JSON.stringify({"locationX":r.point.lng,"locationY":r.point.lat,"userType":"12"}),-->
                <!--async: true,-->
                <!--contentType: "application/json",-->
                <!--headers: __AUTH__,-->
                <!--success: function (resp) {-->
                    <!--console.log(resp.msg) ;-->
                <!--}-->
            <!--});-->
        <!--}-->
        <!--else {-->
            <!--alert('failed'+this.getStatus());-->
        <!--}-->
    <!--},{enableHighAccuracy: true});-->
    <!--//关于状态码-->
    <!--//BMAP_STATUS_SUCCESS	检索成功。对应数值“0”。-->
    <!--//BMAP_STATUS_CITY_LIST	城市列表。对应数值“1”。-->
    <!--//BMAP_STATUS_UNKNOWN_LOCATION	位置结果未知。对应数值“2”。-->
    <!--//BMAP_STATUS_UNKNOWN_ROUTE	导航结果未知。对应数值“3”。-->
    <!--//BMAP_STATUS_INVALID_KEY	非法密钥。对应数值“4”。-->
    <!--//BMAP_STATUS_INVALID_REQUEST	非法请求。对应数值“5”。-->
    <!--//BMAP_STATUS_PERMISSION_DENIED	没有权限。对应数值“6”。(自 1.1 新增)-->
    <!--//BMAP_STATUS_SERVICE_UNAVAILABLE	服务不可用。对应数值“7”。(自 1.1 新增)-->
    <!--//BMAP_STATUS_TIMEOUT	超时。对应数值“8”。(自 1.1 新增)-->
<!--</script>-->
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            userinfodata:[]
        },
        methods: {
        },
        computed: {
        },
        filters: {
        },
        mounted: function () {
            var then = this;
            $.ajax({
                type: "post",
                url: "api/getuserInfo",
                async: true,
                contentType: "application/json",
                success: function (resp) {
                    then.userinfodata =resp.data[0];
                    console.log(resp.data[0]);
                },
                error:function(err){
                    console.log(err)
                }
            });
        }
    })
</script>
</html>
<script>
    $("#beginsign").click(function(){
        // 百度地图API功能
        var __DOMAIM__ = location.origin;   //协议+域名+端口
        //协议+域名+端口+php入口
        var __APIHOST__ = __DOMAIM__ + '/api/';
        var __AUTH__ = {"auth": "wy_jsjxhj6eZRxMTx2yiyunZvnG8R65"};
        var map = new BMap.Map("allmap");
        var point = new BMap.Point(116.331398,39.897445);
        map.centerAndZoom(point,12);
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                var mk = new BMap.Marker(r.point);
                $.ajax({
                    type: "POST",
                    url: "api/beginloca",
                    dataType: "json",
                    data: JSON.stringify({"locationX":r.point.lng,"locationY":r.point.lat,"userType":"12"}),
                    async: true,
                    contentType: "application/json",
                    headers: __AUTH__,
                    success: function (resp) {
                        console.log(resp.msg) ;
                        console.log(resp.data) ;
                    }
                });
            }
            else {
                alert('failed'+this.getStatus());
            }
        },{enableHighAccuracy: true});
    })

</script>
<script>
    $("#cun").click(function(){
        // 百度地图API功能
        var __DOMAIM__ = location.origin;   //协议+域名+端口
        //协议+域名+端口+php入口
        var __APIHOST__ = __DOMAIM__ + '/api/';
        var __AUTH__ = {"auth": "wy_jsjxhj6eZRxMTx2yiyunZvnG8R65"};
        var map = new BMap.Map("allmap");
        var point = new BMap.Point(116.331398,39.897445);
        map.centerAndZoom(point,12);

        var geolocation = new BMap.Geolocation();
// 开启SDK辅助定位
        geolocation.enableSDKLocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                var mk = new BMap.Marker(r.point);
                map.addOverlay(mk);
                map.panTo(r.point);
                $.ajax({
                    type: "POST",
                    url: "api/saveloca",
                    dataType: "json",
                    data: JSON.stringify({"locationX":r.point.lng,"locationY":r.point.lat,"userType":"12","signId":7}),
                    async: true,
                    contentType: "application/json",
                    headers: __AUTH__,
                    success: function (resp) {
                        $.ajax({
                            type: "POST",
                            url: "api/checkLoca",
                            dataType: "json",
                            data: JSON.stringify({"signId":7,"signpassword":"771756"}),
                            async: true,
                            contentType: "application/json",
                            headers: __AUTH__,
                            success: function (resp) {
                                console.log(resp.msg) ;
                            }
                        });
                    }
                });
            }
            else {
                alert('failed'+this.getStatus());
            }

        });
    });




//            var map = new BMap.Map("allmap");
//        var point = new BMap.Point(116.331398,39.897445);
//        map.centerAndZoom(point,12);
//        var geolocation = new BMap.Geolocation();
//        geolocation.getCurrentPosition(function(r){
//            if(this.getStatus() == BMAP_STATUS_SUCCESS){
//                var mk = new BMap.Marker(r.point);
//                map.addOverlay(mk);
//                map.panTo(r.point);
//
//            }
//            else {
//                alert('failed'+this.getStatus());
//            }
//        },{enableHighAccuracy: true});
//    })

</script>
<script>
    $("#sign").click(function(){
        // 百度地图API功能
        var __DOMAIM__ = location.origin;   //协议+域名+端口
        //协议+域名+端口+php入口
        var __APIHOST__ = __DOMAIM__ + '/api/';
        var __AUTH__ = {"auth": "wy_jsjxhj6eZRxMTx2yiyunZvnG8R65"};
        var map = new BMap.Map("allmap");
        var point = new BMap.Point(116.331398,39.897445);
        map.centerAndZoom(point,12);
        var geolocation = new BMap.Geolocation();
        geolocation.getCurrentPosition(function(r){
            if(this.getStatus() == BMAP_STATUS_SUCCESS){
                var mk = new BMap.Marker(r.point);
                map.addOverlay(mk);
                map.panTo(r.point);

            }
            else {
                alert('failed'+this.getStatus());
            }
        },{enableHighAccuracy: true});
    })

</script>
